// File:       hoistup.c++
// Version:    1.00
// Author:     (c) Miles Sabin, 1997
// Purpose:    encapsulate type information for template hoisting

// Change log:
//  13/01/97   v. 1.00
//  23/01/97   Singletonized.
//  31/01/97   member_size renamed to member_offset and alignment problems
//               sorted out.
//  23/02/97   Split HoistComparator off from HoistHelper to remove
//               requirement for contained classes to define  operator==()
//               and operator<() whereever possible.
//             member_offset() replaced by member_base_offset().
//  01/04/97   Added HoistUnaryPredicateProtocol.
//             Added HoistBinaryPredicateProtocol.

#include "hoistup.h"

#include "newcasts.h"
#include "tpltutil.h"


// Implementation of HoistUnaryPredicate<UnaryPredicate, T>

template<class UnaryPredicate, class T>
HoistUnaryPredicate<UnaryPredicate, T>::~HoistUnaryPredicate()
  {}

template<class UnaryPredicate, class T>
bool HoistUnaryPredicate<UnaryPredicate, T>::operator()(void const* x) const
  {
    // const_cast needed because CFront may think that pred_ is a non-const mfn
    return const_cast(HoistUnaryPredicate<UnaryPredicate _ T>*, this)->pred_(*reinterpret_cast(T const*, x));
  }

